<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path;
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
<title>${player.name}&nbsp;编号：${player.id}&nbsp;爱粮节粮进万家</title>
<meta name="viewport"
	content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="format-detection" content="telephone=no" />
<meta charset="utf-8" />
<link href="<%=basePath%>/css/sweetalert.css" rel="stylesheet" />
<link href="<%=basePath%>/css/idangerous.swiper.css" rel="stylesheet" />
<link href="<%=basePath%>/css/skin.css" rel="stylesheet" />
<link href="<%=basePath%>/css/main.css" rel="stylesheet" />

<script type="text/javascript" src="<%=basePath%>/js/jquery-2.1.0.min.js"></script>
<script type="text/javascript" src="<%=basePath%>/js/idangerous.swiper-2.1.min.js"></script>
<script type="text/javascript" src="<%=basePath%>/js/sweetalert.min.js"></script>
<style>

.info-content-title-a{
	text-align:center;font-size:22px;
	margin:20px 0;
}
.info-content-title-b{
	text-align:center;font-size:16px;
	margin:20px 0;
}
.baiyi-vote-rule ul li a.info-btnvote{
    font-size: 18px;
    background-color: #44b549;
}
.info-content-nn{
	display:block;
	width:220px;
	height:30px;
	line-height:30px;
	margin:10px auto;
	background-color:red;
	color:#fff;
	font-size:16px;
	/* font-weight:bold; */
	border-radius:5px;
}
.info-content-title-nn{
	text-align:center;
}
.baiyi-vote-rule.info-orderinfo ul li {
    color: #000;
    /* background: #ff3963; */
    width: 100%;
    height: 60px;
    line-height: 30px;
    display: block;
    border-radius: 5px;
    text-align: center;
    font-size: 14px;
    border: 1px #ff3963 solid;
    margin: 0 10px;
}
.baiyi-vote-rule.info-orderinfo ul li span{
	color: #ff3963;
	font-size:18px;
	font-weight:bold;
}
.baiyi-vote-info.content{
	margin:10px;
	padding:10px;
    border-radius: 5px;
	
    border: 1px #ff3963 solid;
}
.info-content-img img{
	margin:10px 0;
}
</style>
</head>
<body>
		<div class="baiyi-vote-warp">
			<div class="head" onclick="window.location.href='<%=basePath%>/vote.htm'">
				<img src="<%=basePath%>/images/banner.jpg" alt="" width="100%" />
			</div>
			<div class="baiyi-vote-rule">
				<ul class="clearfix">
					<li><a
						href="<%=basePath%>/voteUpload.htm?openId=${openid}">我要报名</a></li>
					<li><a
						href="<%=basePath%>/voteRank.htm?openId=${openid}">活动排名</a></li>
					<li><a
						href="http://mp.weixin.qq.com/s?__biz=MzA3ODgzOTc3Nw==&mid=403283436&idx=1&sn=03eb40dc9867348f0b39d01d7cefd238&scene=1&srcid=0401ncY5KNXA4njecFP3valm#rd">奖品介绍</a></li>
				</ul>
			</div>
			<div class="baiyi-vote-rule">
				<ul class="clearfix">
					<li><a href="javascript:void(0);" class="btnvote info-btnvote" voteId="113"
						itemId="${player.id }" propertyId="1">为他投票</a></li>
					<li><a
						href="javascript:void(0);" onclick="guideshareShow()">点我拉票</a></li>
				</ul>
			</div>
			<form action="<%=basePath%>/vote.htm" id="formSearch">
				<div class="search-input">
					<input type="text" placeholder="请输入编号 或姓名" id="searchvalue" name="key" value="${key }"/>
				</div>
				<div class="search-btn">
					<a id="search">搜索</a>
				</div>
			</form>
			<div class="baiyi-vote-info info-content-nn">
				<h3 style="" class="info-content-title-nn">${player.name}&nbsp;编号：${player.id}</h3>
			</div>
			<div class="baiyi-vote-rule info-orderinfo">
				<ul class="clearfix" style="padding:0;">
					<li>
					<p>当前票数</p>
					<p><span>${player.votedNum}</span>票</p>
					</li>
					<li>
					<p>当前排名</p>
					<p>第<span>${player.rank}</span>名</p>
					</li>
				</ul>
			</div>
			<div class="baiyi-vote-info content">
				<div class="info-content">
					<h3 style="" class="info-content-title-a">${player.title}</h3>
				</div>
				<div class="info-content">
					<!-- <h3 style="" class="info-content-title-b">生活小常识</h3> -->
					<div class="">&nbsp;&nbsp;&nbsp;&nbsp;${player.content}</div>
				</div>
				<div class="info-content">
					<!-- <h3  class="info-content-title-b">图片</h3> -->
					<div class="info-content-img">
						<c:forEach items="${compressList }" varStatus="status" var="compress">
						<img style="width:100%" class="" alt="" src="<%=basePath%>/upload/${compress}">
						</c:forEach>
						<%-- 
						<img style="width:100%" class="" alt="" src="<%=basePath%>/upload/55a7b526-9648-47f7-bb01-e48a6583a8ca.jpeg">
						<img style="width:100%" class="" alt="" src="<%=basePath%>/upload/7ca888f4-bb2a-446f-8fe4-773254ab1cad.png"> --%>
					</div>
				</div>
			
<%-- 				<div class="preview">
					<img
						src="<%=basePath%>/upload/${player.img}"
						class="imglist"><i class="close"></i>
				</div>
				${player.content } --%>
			</div>
			<div class="baiyi-vote-property">
				<a href="javascript:void(0);" class="btnvote" voteId="113"
					itemId="${player.id }" propertyId="1">投票</a>
			</div>
			<div class="baiyi-copyright"></div>
		</div>
		<!-- 引导分享 -->
		<div id="vote-guideshare" style='display:none'>
			<div class="guideshare-bac">
			</div>
			<div class="guideshare-pointer">
				<svg style="width:40px;height:40px;" version="1.1" id="图形" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="1024px" height="1024px" viewBox="0 0 1024 1024" enable-background="new 0 0 1024 1024" xml:space="preserve">
					<path class="svgpath" data-index="path_0" fill="#fff" d="M695.629739 224.593198c-6.04774 0-11.587919-4.027733-13.220093-10.155291-1.966795-7.305383 2.367931-14.82566 9.68764-16.778128l31.403221-8.416693c7.291057-1.980097 14.811334 2.367931 16.778128 9.686616 1.952468 7.305383-2.382257 14.82566-9.68764 16.779152l-31.403221 8.41567C697.998693 224.445842 696.806541 224.593198 695.629739 224.593198z" />
					<path class="svgpath" data-index="path_1" fill="#fff" d="M409.267732 301.314557c-6.04774 0-11.586896-4.027733-13.219069-10.155291-1.966795-7.305383 2.367931-14.82566 9.68764-16.778128l227.006154-60.813041c7.346315-1.9934 14.812357 2.367931 16.778128 9.68764 1.953492 7.305383-2.381234 14.824637-9.68764 16.778128l-227.006154 60.812017C411.636686 301.167201 410.445558 301.314557 409.267732 301.314557z" />
					<path class="svgpath" data-index="path_2" fill="#fff" d="M232.288972 949.922864c-17.72878 0-34.440393-8.081049-51.098795-24.753777L76.210217 820.181965c-52.008514-51.995211-12.938684-91.051739 5.833869-109.823268C208.739627 589.323063 268.856819 531.961634 297.504276 504.665964l-116.192326-74.862012c-40.047088-21.702278-60.987003-60.531632-56.062853-104.111173 5.981225-52.918233 49.426713-99.039667 108.084671-114.76072L779.737322 64.553225c59.635215-16.015765 112.326275-2.823302 141.013641 34.574447 23.387663 30.480198 29.100782 74.005504 16.095583 122.535801l-146.404418 546.364669c-18.839067 70.365604-81.177857 102.417601-131.125433 102.417601l0 0c-40.890292 0-74.822103-20.097734-88.912006-52.563146l-59.527768-114.186645c-29.676903 29.208229-91.185792 89.566922-219.368196 215.159338C277.152762 933.197948 257.243317 949.922864 232.288972 949.922864zM104.937492 768.683057c0.106424 0 1.297552 4.027733 10.021238 12.751419L219.939713 886.421598c8.616238 8.616238 12.30935 8.696056 12.349259 8.696056 0.561795 0 5.873778-0.427742 20.658506-15.225773 65.74947-64.404846 236.721423-231.991702 245.109464-240.514819 5.861498-6.235005 14.277168-9.392928 22.89443-8.482185 9.111518 0.976234 17.139356 6.448876 21.381983 14.569834l77.162404 148.024312c0.361227 0.708128 0.696872 1.431605 1.00284 2.167363 7.707542 18.545378 31.658024 19.990287 38.817074 19.990287 29.690206 0 66.819848-19.335371 78.178547-61.803601l146.418744-546.363645c8.496511-31.711236 6.141884-58.337663-6.635117-74.996065-12.698207-16.537651-33.410947-20.00359-48.556902-20.00359-10.704806 0-22.411429 1.685385-34.802644 5.003967L247.529071 263.863596c-42.843784 11.480472-64.933895 42.428322-67.823712 67.997674-2.408863 21.341051 7.653307 39.137369 28.339442 50.094932 0.695848 0.361227 1.364067 0.762363 2.020006 1.177825l146.418744 94.329389c7.305383 4.710278 11.948123 12.604062 12.510942 21.287839 0.548492 8.670473-3.037173 17.099447-9.686616 22.706141-5.178953 4.803399-174.302815 166.314887-238.968603 228.090858-12.938684 12.951987-15.093766 17.688871-15.400758 19.147082L104.938516 768.683057z" />
				</svg>
			</div>
			<!-- <div class="guideshare-text" onclick="shareSuccessAJAX()"> -->
			<div class="guideshare-text" style="width:150px">
				<p>点击分享</p>
				<p>告诉朋友们</p>
				<p>帮你投一票</p>
			</div>
		</div>
</body>
<script type="text/javascript">
	var page = 0;
	var loading = false;
	var voting = false;
	$(function() {
		vote();
		var mySwiper = new Swiper('.swiper-container', {
			calculateHeight : true,
			roundLengths : true,
			loop : true
		});
		if('${error}'=='error'){
			swal({   
				title: "错误",   
						text: "请先关注本微信号！",   
						type: "warning",   
						confirmButtonColor: "#DD6B55",   
						confirmButtonText: "确定",   
						closeOnConfirm: false 
				}, 
				function(){   
					location.href="<%=basePath%>/sub.htm";
				});
			
		}
	})
	function vote() {
		$(".btnvote").each(function() {
			$(this).click(function() {
				var that = this;
				var itemId = $(this).attr("itemId");
				var sign = "";
				if (!voting) {
					$.ajax({
						type : "POST",
						url : "<%=basePath%>/doVote.htm?d="+ new Date(),
						data : {
							id : itemId,
						},
						beforeSend : function() {
							voting = true
						},
						success : function(data) {
							//var data = eval("(" + data + ")");
							if (data=="success") {
								voting = false;
								swal({
									title : "投票成功！",
									type : "success"
								}
								,function(){   
									//确认后刷新
									window.location.href=window.location.href;
								});
								$(that).html("我已投票");
								
							} else {
								voting = false;
								swal({
									title : data,
									type : "error"
								}, function() {
								});
							}
						},
						error : function() {
							swal({
								title : "网络异常",
								type : "error"
							});
						}
					})
				}
			})
		})
	}		
	//搜索
	$("#search").click(
			function() {
				$('#formSearch').submit();
				
				//var url = "<%=basePath%>/vote.htm?key="+ $("#searchvalue").val();
				//window.location.href = url;
				//return false;
			});
	//引导分享
	$guideshare=$("#vote-guideshare");
	function guideshareShow(){
		$guideshare.show();
	}
	function guideshareHide(){
		$guideshare.hide();
	}
	
	$guideshare.click(function(){
		guideshareHide();
	});
</script>
</html>